 {
        var o = require("../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                seatId: 0,
                standTilePrefab: {
                    default: null,
                    type: cc.Prefab
                },
                lieTilePrefab: {
                    default: null,
                    type: cc.Prefab
                },
                standTilePool: [],
                lieTilePool: [],
                tableModel: null,
                _needSendTileAction: !1,
                _needSortAction: !1,
                _needInsertAction: !1,
                _needInsertActionTile: -1,
                _needInsertActionTileIndex: -1,
                _isFirstTile: !0
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.GAME_REFRESH_STAND_TILE, this._onRefreshStandTile.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_SET_HUANPAI_STAND_TILE, this._setHuanPaiStandTile.bind(this), this),
                    this.tableModel = Global.tableModel, this.initTile();
            },
            start: function () {
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            },
            update: function (e) {
                if (this.seatId == Global.config.SEAT_DOWN) {
                    var t = this.node.childrenCount;
                    if (t) for (var n = 0; n < t; n++) this.node.children[n].y > 0 && Global.tableModel.setIsTileUp(!0);
                }
            },
            initTile: function () {
                var e = 0, t = 14, n = 0;
                this.seatId != Global.config.SEAT_DOWN && this.seatId != Global.config.SEAT_UP && this.seatId != Global.config.SEAT_LEFT || (n = 0),
                this.seatId == Global.config.SEAT_RIGHT && (n = -1);
                for (var o = 0; o < 14; o++) {
                    var i = cc.instantiate(this.standTilePrefab);
                    this.node.addChild(i, t), this.standTilePool.push(i), i.active = !1;
                    var a = cc.instantiate(this.lieTilePrefab);
                    this.node.addChild(a, t), this.lieTilePool.push(a), a.active = !1, t += n, e += i.width;
                }
                if (this.seatId == Global.config.SEAT_DOWN) {
                    var r = this.node.width;
                    SceneHelper.getCurScene() && SceneHelper.getCurScene().getComponent("TableController") && SceneHelper.getCurScene().getComponent("TableController").setMyDownTilesWidth(e, r, !0);
                }
            },
            refresh: function () {
                var e = this.tableModel.getPlayerModel(this.seatId);
                if (null != e) {
                    for (var t = 0; t < this.standTilePool.length; t++) this.standTilePool[t].active = !1;
                    for (t = 0; t < this.lieTilePool.length; t++) this.lieTilePool[t].active = !1;
                    var n = e.getStandup_tiles(), i = n.length,
                        a = Global.tableModel.getIsGameEnd() || Global.tableModel.getIsShowLuckyTile(), r = e.isWin(),
                        s = e.isLose(), l = this.standTilePool.length, c = 0;
                    this.initIndex = 0;
                    var d, u = function () {
                        var e = 3, t = 3;
                        if (Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK && (e = 0,
                            t = 1), c > e) {
                            this._isIniting = !1, this.unscheduleAllCallbacks();
                            var n = this.refreshData;
                            this._onRefreshStandTile(n);
                        } else {
                            o.playTileDrawTileSound();
                            for (var i = ++c > t ? 1 : 4, a = this.initIndex; a < this.initIndex + i; a++) {
                                var r = this.standTilePool[a];
                                if (r) {
                                    r.active = !0;
                                    var s = r.getPosition(), l = cc.p(s.x, s.y + 10);
                                    r.setPosition(l), r.active = !0, r.runAction(cc.moveTo(.1, cc.p(s, s)).easing(cc.easeBackIn(3)));
                                }
                            }
                            this.initIndex = this.initIndex + i;
                        }
                    };
                    if (this.seatId == Global.config.SEAT_DOWN) {
                        var h = 0, f = 0, p = 0;
                        1 == a && (p = 50), Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK && (p += 350);
                        for (t = 0; t < i; t++) {
                            var g = cc.callFunc(function () {
                            }), b = !1, m = null, _ = cc.p(0, 0);
                            if (1 == a) {
                                if (k = this.lieTilePool[t]) m = k, k.active = !0, t == i - 1 && t % 3 == 1 && (h = 20,
                                    f = 0, b = !0), _ = x = cc.p(p + k.width * t + h, 0 + f), k.setPosition(x), (d = k.getComponent("NodeLieTileController")) && d.updateTile(n[t], a);
                            } else {
                                if (k = this.standTilePool[t]) {
                                    m = k, k.stopAllActions(), k.rotation = 0, this._isInitTile || (k.active = !0);
                                    var y = cc.p(k.x, k.y);
                                    if (t == i - 1 && t % 3 == 1 && (h = 20, f = 0, b = !0), _ = x = cc.p(p + k.width * t + h, 0 + f),
                                        k.setPosition(x), (d = k.getComponent("standTileDownController")) && d.updateTile(n[t], t),
                                    1 == this._needSortAction) {
                                        var S = Global.tableModel.getIsNeedTileAction();
                                        if (console.log("needTileAction ==== ", S), this._needInsertAction && this._needInsertActionTile == n[t] && t != i - 1 && S) {
                                            this._needInsertActionTile = -1;
                                            var I = cc.p(p + k.width * i + 20, 0 + f + k.height),
                                                v = cc.p(x.x, x.y + k.height);
                                            k.rotation = 30;
                                            var C = cc.spawn(cc.rotateTo(.1, 0), cc.moveTo(.1, x));
                                            g = cc.sequence(cc.place(I), cc.moveTo(.3, v), C), k.runAction(g);
                                        } else y.y = 0, 1 == this._needInsertAction && t >= this._needInsertActionTileIndex && this._needInsertActionTileIndex >= 0 && (y = cc.p(y.x + k.width, y.y)),
                                            g = cc.sequence(cc.place(y), cc.moveTo(.3, x)), k.runAction(g);
                                    }
                                }
                                d && d.setAction(g);
                            }
                            if (1 == b && null != m && 1 == this._needSendTileAction) {
                                m.rotation = 30;
                                var G = cc.p(_.x + 20, _.y + 100),
                                    T = (C = cc.spawn(cc.rotateTo(.1, 0), cc.moveTo(.1, _), cc.callFunc(function () {
                                        o.playSendTileEffect();
                                    })), cc.sequence(cc.place(G), C));
                                k.stopAllActions(), g = T, k.runAction(g), d && d.setAction(g);
                            }
                        }
                        this._isInitTile && (u.call(this), this.schedule(u.bind(this), .5));
                    } else if (this.seatId == Global.config.SEAT_RIGHT) {
                        var w = 0, E = (h = -9, f = 0, 0), A = 0, N = .85;
                        for (t = 0; t < i; t++) {
                            b = !1, m = null, _ = cc.p(0, 0);
                            if (1 == r || 1 == a || 1 == s) {
                                if (k = this.lieTilePool[t]) {
                                    m = k;
                                    var M = N + (1 - N) * (l - t) / l;
                                    k.scaleX = M, k.scaleY = M;
                                    var P = M * k.height;
                                    k.active = !0;
                                    var R = !1;
                                    t == i - 1 && t % 3 == 1 && (E = -11 * M, A = 20 * M, b = !0, R = !0), 1 != a && 1 != s || (R = !1),
                                    (d = k.getComponent("NodeLieTileController")) && d.updateTile(n[t], a, R), _ = x = cc.p(w + E, P * t + A),
                                        k.setPosition(x), w += h * M;
                                }
                            } else if (k = this.standTilePool[t]) {
                                m = k;
                                M = N + (1 - N) * (l - t) / l;
                                k.scaleX = M, k.scaleY = M;
                                P = M * k.height;
                                this._isInitTile || (k.active = !0), t == i - 1 && t % 3 == 1 && (E = -11 * M, A = 20 * M,
                                    b = !0), _ = x = cc.p(w + E, P * t + A), k.setPosition(x), w += h * M;
                            }
                            if (1 == b && null != m && 1 == this._needSendTileAction) {
                                m.rotationY = 0;
                                G = cc.p(_.x + 0, _.y + 50), C = cc.spawn(cc.rotateTo(.2, 0, 0), cc.moveTo(.2, _), cc.callFunc(function () {
                                    this._isFirstTile || o.playSendTileEffect(), this._isFirstTile = !1;
                                }.bind(this))), T = cc.sequence(cc.place(G), C);
                                k.stopAllActions(), k.runAction(T);
                            }
                        }
                        this._isInitTile && (u.call(this), this.schedule(u.bind(this), .5));
                    } else if (this.seatId == Global.config.SEAT_UP) {
                        h = 0, f = 0, p = 0;
                        Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK && (p -= 150);
                        for (t = 0; t < i; t++) {
                            b = !1, m = null, _ = cc.p(0, 0);
                            if (1 == r || 1 == a || 1 == s) {
                                if (k = this.lieTilePool[t]) {
                                    m = k, k.active = !0;
                                    R = !1;
                                    t == i - 1 && t % 3 == 1 && (h = -20, f = 0, b = !0, R = !0), 1 != a && 1 != s || (R = !1),
                                    (d = k.getComponent("NodeLieTileController")) && d.updateTile(n[t], a, R), _ = x = cc.p(p + (-1 * k.width * t + h), 0 + f),
                                        k.setPosition(x);
                                }
                            } else if (k = this.standTilePool[t]) m = k, this._isInitTile || (k.active = !0),
                            t == i - 1 && t % 3 == 1 && (h = -20, f = 0, b = !0), _ = x = cc.p(p + (-1 * k.width * t + h), 0 + f),
                                k.setPosition(x);
                            if (1 == b && null != m && 1 == this._needSendTileAction) {
                                m.rotation = 0;
                                G = cc.p(_.x + 10, _.y + 50), C = cc.spawn(cc.rotateTo(.2, 0), cc.moveTo(.2, _), cc.callFunc(function () {
                                    this._isFirstTile || o.playSendTileEffect(), this._isFirstTile = !1;
                                }.bind(this))), T = cc.sequence(cc.place(G), C);
                                k.stopAllActions(), k.runAction(T);
                            }
                        }
                        this._isInitTile && (u.call(this), this.schedule(u.bind(this), .5));
                    } else if (this.seatId == Global.config.SEAT_LEFT) {
                        for (w = 0, h = -10, f = 0, E = 0, A = 0, N = .8, t = 0; t < i; t++) {
                            var k;
                            b = !1, m = null, _ = cc.p(0, 0);
                            if (1 == r || 1 == a || 1 == s) {
                                if (k = this.lieTilePool[t]) {
                                    m = k;
                                    M = N + (1 - N) * t / l;
                                    k.scaleX = M, k.scaleY = M;
                                    P = M * k.height;
                                    k.active = !0;
                                    R = !1;
                                    t == i - 1 && t % 3 == 1 && (E = -11 * M, A = -20 * M, b = !0, R = !0), 1 != a && 1 != s || (R = !1),
                                    (d = k.getComponent("NodeLieTileController")) && d.updateTile(n[t], a, R), _ = x = cc.p(w + E, -1 * P * t + A),
                                        k.setPosition(x), w += h * M;
                                }
                            } else if (k = this.standTilePool[t]) {
                                m = k;
                                M = N + (1 - N) * t / l;
                                k.scaleX = M, k.scaleY = M;
                                var x;
                                P = M * k.height;
                                this._isInitTile || (k.active = !0), t == i - 1 && t % 3 == 1 && (E = -11 * M, A = -20 * M,
                                    b = !0), _ = x = cc.p(w + E, -1 * P * t + A), k.setPosition(x), w += h * M;
                            }
                            if (1 == b && null != m && 1 == this._needSendTileAction) {
                                m.rotationY = 0;
                                G = cc.p(_.x, _.y + 70), C = cc.spawn(cc.rotateTo(.2, 0, 0), cc.moveTo(.2, _), cc.callFunc(function () {
                                    this._isFirstTile || o.playSendTileEffect(), this._isFirstTile = !1;
                                }.bind(this))), T = cc.sequence(cc.place(G), C);
                                k.stopAllActions(), k.runAction(T);
                            }
                        }
                        this._isInitTile && (u.call(this), this.schedule(u.bind(this), .5));
                    }
                } else cc.error("NodeStandController refresh error playerModel = null seatIndex = " + this.seatId);
            },
            _onRefreshStandTile: function (e) {
                e && null != e.refreshSeatId && e.refreshSeatId != this.seatId || (this._isIniting && e && 1 == e.needSendTileAction ? this.refreshData = e : (this._isInitTile = !1,
                e && 1 == e.isInitTile && (this._isInitTile = e.isInitTile, this._isIniting = !0),
                    this._needSendTileAction = !1, e && 1 == e.needSendTileAction && (this._needSendTileAction = !0),
                    this._needSortAction = !1, this._needInsertActionTile = -1, this._needInsertAction = !1,
                    this._needInsertActionTileIndex = -1, e && 1 == e.needSortAction && (this._needSortAction = !0,
                    this._needInsertAction = e.needInsertAction || !1, this._needInsertActionTile = e.needInsertActionTile || -1,
                    this._needInsertActionTileIndex = e.needInsertActionTileIndex || -1), e && 0 == e.needRefresh || this.refresh()));
            },
            _setHuanPaiStandTile: function (e) {
                var t = e.upIndexs || [], n = this.standTilePool;
                console.log("_setHuanPaiStandTile data:", e);
                for (var o = 0; o < t.length; o++) {
                    var i = t[o], a = n[i];
                    if (a && a.getComponent("standTileDownController")) {
                        console.log("_setHuanPaiStandTile index:", i), a.getComponent("standTileDownController").setHuanPaiStandTile();
                        var r = {
                            tileIndex: i,
                            tileValue: -1
                        };
                        Global.notificationCenter.emit(Global.eventName.GAME_UPDATE_SELECT_TILE, r);
                    }
                }
            }
        })
    }